package com.cencat.common.constant;

/**
 * 通用常量定义
 */
public class CommonConstants {
    
    private CommonConstants() {
        // 私有构造器，防止实例化
    }
    
    /**
     * 系统常量
     */
    public static final String SYSTEM_NAME = "Cencat SaaS Platform";
    public static final String SYSTEM_VERSION = "1.0.0";
    public static final String UTF8 = "UTF-8";
    public static final String CONTENT_TYPE_JSON = "application/json";
    
    /**
     * 时间格式常量
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd";
    public static final String TIME_FORMAT = "HH:mm:ss";
    public static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
    
    /**
     * 布尔值常量
     */
    public static final Integer TRUE = 1;
    public static final Integer FALSE = 0;
    
    /**
     * 状态常量
     */
    public static final Integer STATUS_ENABLED = 1;
    public static final Integer STATUS_DISABLED = 0;
    public static final Integer STATUS_DELETED = -1;
    
    /**
     * 分页常量
     */
    public static final Integer DEFAULT_PAGE_SIZE = 20;
    public static final Integer MAX_PAGE_SIZE = 1000;
    public static final String PAGE_NUM = "pageNum";
    public static final String PAGE_SIZE = "pageSize";
    
    /**
     * 缓存常量
     */
    public static final String CACHE_PREFIX = "cencat:";
    public static final Long CACHE_EXPIRE_TIME = 3600L; // 1小时
    
    /**
     * 租户常量
     */
    public static final String DEFAULT_TENANT_CODE = "default";
    public static final String TENANT_HEADER = "X-Tenant-Id";
    public static final String TENANT_PARAM = "tenantId";
    
    /**
     * 权限常量
     */
    public static final String TOKEN_HEADER = "Authorization";
    public static final String TOKEN_PREFIX = "Bearer ";
    public static final Long TOKEN_EXPIRE = 7200L; // 2小时
    
    /**
     * 文件常量
     */
    public static final Long MAX_FILE_SIZE = 10485760L; // 10MB
    public static final String[] ALLOWED_FILE_TYPES = {
        "jpg", "jpeg", "png", "gif", "pdf", "doc", "docx", "xls", "xlsx", "txt"
    };
    
    /**
     * 响应码常量
     */
    public static final Integer SUCCESS_CODE = 200;
    public static final Integer ERROR_CODE = 500;
    public static final Integer UNAUTHORIZED_CODE = 401;
    public static final Integer FORBIDDEN_CODE = 403;
    public static final Integer NOT_FOUND_CODE = 404;
    
    /**
     * 正则表达式常量
     */
    public static final String REGEX_MOBILE = "^1[3-9]\\d{9}$";
    public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
    public static final String REGEX_USERNAME = "^[a-zA-Z][a-zA-Z0-9_]{3,15}$";
    public static final String REGEX_PASSWORD = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{8,20}$";
    
    /**
     * 字符集常量
     */
    public static final String CHARSET_UTF8 = "UTF-8";
    public static final String CHARSET_GBK = "GBK";
    public static final String CHARSET_ISO = "ISO-8859-1";
}